/**
 * Meituan.com Inc.
 * Copyright (c) 2010-2018 All Rights Reserved.
 */
package com.tuyou.demo1;

import org.apache.thrift.TProcessor;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TTransportException;

/**
 * <p></p>
 *
 * @author tuyou@meituan.com
 * @version v0.1 2018-11-23 8:57 PM tuyou Exp $$
 */
public class HelloServiceServer {

    public static void main(String[] args) throws TTransportException {
        System.out.println("服务端开启....");
        TProcessor tprocessor = new Hello.Processor<Hello.Iface>(new HelloServiceImpl());
        // 简单的单线程服务模型
        TServerSocket serverTransport = new TServerSocket(9898);
        TServer.Args tArgs = new TServer.Args(serverTransport);
        tArgs.processor(tprocessor);
        tArgs.protocolFactory(new TBinaryProtocol.Factory());
        TServer server = new TSimpleServer(tArgs);
        server.serve();
    }
}